package org.sage.sdk.dada.order.entity;

import lombok.Data;
import org.sage.sdk.dada.infrastructure.common.BaseEntity;
import org.sage.sdk.dada.infrastructure.common.attributes.CityCode;
import org.sage.sdk.dada.infrastructure.common.attributes.Info;
import org.sage.sdk.dada.infrastructure.common.attributes.OrderId;
import org.sage.sdk.dada.infrastructure.common.attributes.Tips;
import org.sage.sdk.dada.infrastructure.utils.GetBodyUtil;

import javax.validation.constraints.NotNull;

/**
 * 增加小费
 * <p>
 * 可以对待接单状态的订单增加小费。需要注意：订单的小费，以最新一次加小费动作的金额为准，故下一次增加小费额必须大于上一次小费额。
 * <p>
 * 接口调用URL地址：/api/order/addTip。
 *
 * @author 周广明
 * @version v1 2019/12/10 下午6:17
 */
@Data
public class AddTip implements BaseEntity {

    @Override
    public String getUrl() {
        return "/api/order/addTip";
    }

    @Override
    public String getBody() {
        return GetBodyUtil.toJsonStr(this);
    }

    public AddTip(OrderId orderId, Tips tips, CityCode cityCode) {
        this.orderId = orderId;
        this.tips = tips;
        this.cityCode = cityCode;
    }

    @NotNull
    OrderId orderId;

    @NotNull
    Tips tips;

    @NotNull
    CityCode cityCode;

    Info info;
}